package com.hnichr.ump.common.util;

import org.apache.commons.lang3.StringUtils;

public class MinioUtils {

    public static String getObjectName(String url){
        String ObjectName = url;
        if(StringUtils.startsWithIgnoreCase(url,"http")){
            ObjectName = StringUtils.substring(ObjectName,StringUtils.indexOf(ObjectName,"//")+2);
            ObjectName = StringUtils.substring(ObjectName,StringUtils.indexOf(ObjectName,"/")+1);
        }
        ObjectName = StringUtils.substring(ObjectName,StringUtils.indexOf(ObjectName,"/")+1);
        return ObjectName;
    }

    public static String getFileName(String url){
        return StringUtils.substring(url,StringUtils.lastIndexOf(url,"/")+1);
    }

    public static void main(String [] arg){
        System.out.println(MinioUtils.getFileName("http://ecs.fangsong.tech:9000/hn-talent-ump/assessment/2022/11/11/6698401100132/社会招聘胜任力基本分析报告.pdf"));
    }

}
